
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
	xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
	xmlns:mywidgets="http://xmlns.jcp.org/jsf/composite/widgets"
	xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
>

<ui:composition template="/templates/photoTemplate.xhtml">

	<ui:define name="title">
		Mietanfrage
	</ui:define>

	<ui:define name="navReferences">
	</ui:define>

	<ui:define name="body">

		<h:outputStylesheet name="css/calendar.css" />

		<script>
		$(function() {
			$(document).tooltip({
			track: true
			});

			 $('input:visible:enabled:first').focus();

			$('form:first *:input[type!=hidden]:first').focus();

			$( "#footer" ).fadeOut(2000, function() {
				// Animation complete
			});
		});
		</script>

		<h1>#{i18N.getTrans('ReservationRequest')}</h1>

		<h:form class="background">

			<h:inputHidden id="startDate"
				value="#{reservationController.startDate}"
			>
				<f:convertDateTime pattern="yyyy-MM-dd" />
			</h:inputHidden>
			<h:inputHidden id="endDate" value="#{reservationController.endDate}">
				<f:convertDateTime pattern="yyyy-MM-dd" />
			</h:inputHidden>

			<h:inputHidden id="numberOfGuests"
				value="#{reservationController.numberOfGuests}"
			/>

			<div class="summaryList">
				<div>
					<h:outputText value="#{reservationController.localizedDate}"
						escape="false"
					/>
				</div>
				<p />
				<div id="summaryGuests">#{reservationController.numberOfGuests}
					Gäste</div>

				<div id="summaryTotal">
					<h:outputText
						value="#{reservationController.calculateTotalCosts()}"
					>
						<f:convertNumber type="currency" currencyCode="EUR"
							maxFractionDigits="2"
						/>
					</h:outputText>
				</div>
			</div>

			<p class="betweenSections" />

			<h:panelGroup id="userdata">

				<h:panelGroup id="loggedIn" rendered="#{loginController.loggedIn}">
					#{i18N.getTrans('ThisReservationWillBePlacedFor')} #{loginController.user.username}
					
					<p class="betweenSections" />

					<h:commandButton
						value="#{i18N.getTrans('btn:ConfirmReservationRequest')}"
						action="#{reservationController.saveReservationRequest}"
						style="width: 300px;"
					>
						<f:ajax execute="@form" render="@none" />
					</h:commandButton>
				</h:panelGroup>

				<h:panelGroup id="notLoggedIn"
					rendered="#{!loginController.loggedIn}"
				>
				
					#{i18N.getTrans('YouAreNotYetRegistered')}
					<p></p>
					
					#{i18N.getTrans('LoginInTheLeftNavigationPanel')}	
					
					<h:link outcome="/registration">#{i18N.getTrans('OrRegisterFirst')}</h:link>

				</h:panelGroup>

			</h:panelGroup>


		</h:form>

	</ui:define>
</ui:composition>
</html>
